<?php
Yii::import ( 'zii.widgets.CListView' );
class ListView extends CListView {
	public $cssFile = false;
	
	public $loadingCssClass = 'loading';
	
	public $template = "{sorter}\n{pager}\n{items}\n{pager}";
	public $pagerCssClass = 'pagination pagination-right';
	
	public $pager = array('class' => 'application.widgets.LinkPager');

	/**
	 *	修改空数据显示样式
	 * @see CBaseListView::renderEmptyText()
	 */
	public function renderEmptyText() {
		$emptyText = $this->emptyText === null ? '' : $this->emptyText;
		echo CHtml::tag ( 'div', array (
			'class' => 'empty' 
		), $emptyText );
	}
	
	/**
	 *	修改分页显示样式
	 * @see CBaseListView::renderPager()
	 */
	public function renderPager()
	{
		if(!$this->enablePagination)
			return;
	
		$pager=array();
		$class='CLinkPager';
		if(is_string($this->pager))
			$class=$this->pager;
		elseif(is_array($this->pager))
		{
			$pager=$this->pager;
			if(isset($pager['class']))
			{
				$class=$pager['class'];
				unset($pager['class']);
			}
		}
		$pager['pages']=$this->dataProvider->getPagination();
	
		if($pager['pages']->getPageCount()>1)
		{
			echo '<div class="'.$this->pagerCssClass.'">';
			$this->widget($class,$pager);
			echo '</div>';
		}
		else
			$this->widget($class,$pager);
	}
}
?>